Approve Company Ticket by ID
The Approve Company Ticket by ID API grants approval to the added companies that are awaiting for approval. It is necessary to provide the Ticket IDs of the added companies that require approval.
Method: POST
{{URL}}/jsonrpc
Headers
Name | Value |
---|---|
Content-Type | application/json |
Example
Payload Parameters
Parameter | Description |
---|---|
id Mandatory | String Unique ID for each request |
jsonrpc Mandatory | String JSON RPC VERSION - should be "2.0" |
method Mandatory | String Method Name - should be "VisaService.ApproveTickets" |
params Mandatory | Object |
ticketIds (or) companyIds Mandatory | Array Ticket Id or Company Id to be approved "Ticket ID" is mandatory if "Company ID" is not provided "Company ID" is mandatory if "Ticket ID" is not provided |
- cURL
- C#
- Go
- NodeJs
curl --location --globoff '{{URL}}/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{"id":"1","jsonrpc":"2.0","method":"VisaService.ApproveTickets","params":{"api":{"credential":"Basic ay5iYXN1dmFuQGJhbmtjYncub3JnOmUxYWY0Y2ExYzE1MDRiMTNiYzcxZjhlOTY0M2VjZTlj","signature":"{{signature}}"},"payload":{"ticketIds":["622067c0fa88be306e519b5d"]}"payload":{"companyIds":["65df3e61bc2422fb17c9755c"]}}}'
var options = new RestClientOptions("{{URL}}/jsonrpc")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""id"": ""1"",
" + "\n" +
@" ""jsonrpc"": ""2.0"",
" + "\n" +
@" ""method"": ""VisaService.ApproveTickets"",
" + "\n" +
@" ""params"": {
" + "\n" +
@" ""api"": {
" + "\n" +
@" ""credential"": ""Basic ay5iYXN1dmFuQGJhbmtjYncub3JnOmUxYWY0Y2ExYzE1MDRiMTNiYzcxZjhlOTY0M2VjZTlj"",
" + "\n" +
@" ""signature"": ""{{signature}}""
" + "\n" +
@" },
" + "\n" +
@" ""payload"": {
" + "\n" +
@" ""ticketIds"": [
" + "\n" +
@" ""622067c0fa88be306e519b5d""
" + "\n" +
@" ]
" + "\n" +
@" }
" + "\n" +
@" " + "\n" +
@" ""payload"": {
" + "\n" +
@" ""companyIds"": [
" + "\n" +
@" ""65df3e61bc2422fb17c9755c""
" + "\n" +
@" ]
" + "\n" +
@" }
" + "\n" +
@" }
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{URL}}/jsonrpc"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"id": "1",`+"
"+`
"jsonrpc": "2.0",`+"
"+`
"method": "VisaService.ApproveTickets",`+"
"+`
"params": {`+"
"+`
"api": {`+"
"+`
"credential": "Basic ay5iYXN1dmFuQGJhbmtjYncub3JnOmUxYWY0Y2ExYzE1MDRiMTNiYzcxZjhlOTY0M2VjZTlj",`+"
"+`
"signature": "{{signature}}"`+"
"+`
},`+"
"+`
"payload": {`+"
"+`
"ticketIds": [`+"
"+`
"622067c0fa88be306e519b5d"`+"
"+`
]`+"
"+`
}`+"
"+`
"payload": {`+"
"+`
"companyIds": [`+"
"+`
"65df3e61bc2422fb17c9755c"`+"
"+`
]`+"
"+`
}`+"
"+`
}`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{URL}}',
'path': '/jsonrpc',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "{\r\n \"id\": \"1\",\r\n \"jsonrpc\": \"2.0\",\r\n \"method\": \"VisaService.ApproveTickets\",\r\n \"params\": {\r\n \"api\": {\r\n \"credential\": \"Basic ay5iYXN1dmFuQGJhbmtjYncub3JnOmUxYWY0Y2ExYzE1MDRiMTNiYzcxZjhlOTY0M2VjZTlj\",\r\n \"signature\": \"{{signature}}\"\r\n },\r\n \"payload\": {\r\n \"ticketIds\": [\r\n \"622067c0fa88be306e519b5d\"\r\n ]\r\n }\r\n \n \"payload\": {\r\n \"companyIds\": [\r\n \"65df3e61bc2422fb17c9755c\"\r\n ]\r\n }\r\n }\r\n}";
req.write(postData);
req.end();
Body
{
"id": "1",
"jsonrpc": "2.0",
"method": "VisaService.ApproveTickets",
"params": {
"api": {
"credential": "Basic ay5iYXN1dmFuQGJhbmtjYncub3JnOmUxYWY0Y2ExYzE1MDRiMTNiYzcxZjhlOTY0M2VjZTlj",
"signature": "{{signature}}"
},
"payload": {
"ticketIds": [
"622067c0fa88be306e519b5d"
]
}
//or
"payload": {
"companyIds": [
"65df3e61bc2422fb17c9755c"
]
}
}
}
Response: 201
Response Parameters
Parameter | Description |
---|---|
jsonrpc | String JSON RPC VERSION - should be "2.0" |
result | Object |
message | String Approval confirmation message |
id | String Company Ticket number |
{
"jsonrpc": "2.0",
"result": {
"message": "Approved successfully"
},
"id": "1"
}